<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>运营平台</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="renderer" content="webkit">
<!--<meta http-equiv="X-UA-Compatible" content="IE=edge">-->
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/common.css?v=20170207" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/table.css?v=20170117" />
<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/css/jquery-ui.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-1.11.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ui.min.js" type="text/javascript"></script>
 <script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/yunIndex.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery-ym-datePlugin-0.1.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/js/global.js" type="text/javascript"></script>
<script src="<?php echo get_style_cdnurl();?>paimai/cheshan/js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo get_style_cdnurl();?>paimai/yunying/js/jquery.placeholder.min.js"></script>
<script type="text/javascript">
 $(function(){
     $("input").placeholder();
     if (navigator.userAgent.indexOf("Safari") > -1) {
       $("input").css("lineHeight","normal !important");
     };
});
</script>

<link type="text/css" rel="stylesheet" href="<?php echo get_style_cdnurl();?>paimai/yunying/plugin/select2/select2.css" />
<script src="<?php echo get_style_cdnurl();?>paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .consult{display: block;margin-top: 10px;width:100%;height:25px;}
    .select_model{
        -moz-appearance: none;background: rgba(0, 0, 0, 0) url("<?php echo get_style_cdnurl();?>paimai/yunying/images/sanjiao.jpg") no-repeat scroll 115px 5px;
        border: 1px solid #d7d7d7;
        float: left;height: 26px;line-height: 26px;margin-right: 8px;text-indent: 2px;width: 136px;}
    .text_model{border: 1px solid #d7d7d7;  float: left;  height: 24px;  line-height: 24px;  margin: 0 10px 10px 0;  text-align: center;  width: 150px;  }
    .search_btn,.export_btn{height:26px;line-height:26px;
        background: #20ab4f none repeat scroll 0 0;border-radius: 3px;border:medium none;color: #fff;
        margin-left: 7px;padding: 0;width: 60px;float:left;}
    .trace_time{float:left;}
    #trace_start_time,
    #trace_end_time,
    #consult_start_time,
    #consult_end_time{border: 1px solid #d7d7d7;height: 24px;line-height: 24px;margin:0 5px;text-align: center;width: 150px;}
</style>
</head>
<body>
<div class="header">
<div class="headerCo">
<span>你好,<?php echo ($user_info["real_name"]); ?><a href="<?php echo (WEB_URL); ?>Emp/logout">退出</a></span>
<h1><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_logo.jpg"></h1>
</div>
</div>
<div class="mian">
    <div class="mianL">
    <dl>
        <dd>
            <a id="menu_sy" href="/Index/index" class="shouye">首页</a>
        </dd>
        <?php foreach ($tree_menu as $key => $value): ?>
          <dd>
            <span id="menu_<?php echo ($value['first_char']); ?>" ><img src="<?php echo get_style_cdnurl();?>paimai/yunying/images/yun_jia.jpg"><?php echo ($value['name']); ?></span>
            <ul style="display: none;">
                <?php if (!empty($value['children'])): ?>
                    <?php foreach ($value['children'] as $k => $v): ?>
                        <li><a id='menu_<?php echo ($v["first_char"]); ?>' href="<?php echo ($v['url']); ?>"><?php echo ($v['name']); ?></a></li>
                    <?php endforeach ?>
                <?php endif ?>
            </ul>
        <?php endforeach ?>
    </dl>
</div>

<?php $menu = 'cjgl.sfcs'; ?>
<?php $menu=json_encode(explode('.', $menu)); ?>
<script>
    $(function () {
        var cur_menu = '<?php echo ($menu); ?>', cur_menu = eval('[' + cur_menu + ']'), cur_menu = cur_menu[0];
        if (cur_menu == "sy") {
            $("#menu_sy").removeClass('shouye').addClass('current');
        }
        $('#menu_' + cur_menu[0]).click();
        $('#menu_' + cur_menu[0]).find("img").attr("src", "http://img1.isou365.cn/paimai/yunying/images/yun_jie.jpg");
        $(".mianL").css("height", $(document).height() - 95);
        $('#menu_' + cur_menu[1]).addClass('current');
    });
</script>
    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="change_search(0);get_list(1)" class="yuCurrent">待磋商</li>
                <li onclick="change_search(1);get_list(2)">跟踪中</li>
                <li onclick="change_search(0);get_list(3)">流拍</li>
                <li onclick="change_search(2);get_list(4)">磋商成功</li>
                <li onclick="change_search(0);get_list(5)">磋商失败</li>
            </ul>
        </div>

        <div class="yuList">
            <div class="consult clearfix">
                <input id="status" name="status" type="hidden" value="<?php echo ((isset($params["status"]) && ($params["status"] !== ""))?($params["status"]):1); ?>"/>
                <div id="search1">
                    <div class="trace_time">
                    从<input type="text" name="start_time" placeholder="请选择跟踪时间" value="<?php echo ($params["trace_start_time"]); ?>" class="xiaci xin-text1" id="trace_start_time" readonly>
                    到<input type="text" name="end_time"  placeholder="请选择跟踪时间" value="<?php echo ($params["trace_end_time"]); ?>" class="xiaci xin-text1" id="trace_end_time" readonly />
                    </div>
                </div>
                <div id="search2">
                    <div class="trace_time">
                    从<input type="text" name="start_time" placeholder="请选择磋商时间" value="<?php echo ($params["consult_start_time"]); ?>" class="xiaci xin-text1" id="consult_start_time" readonly>
                    到<input type="text" name="end_time"  placeholder="请选择磋商时间" value="<?php echo ($params["consult_end_time"]); ?>" class="xiaci xin-text1" id="consult_end_time" readonly />
                    </div>
                </div>
                <select name="location_area" id="location_area" class="select_model">
                    <?php if(count($bc_city) > 1): ?><option value="0">请选择所在地</option><?php endif; ?>
                    <?php if(is_array($bc_city)): $i = 0; $__LIST__ = $bc_city;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$city): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>"><?php echo ($city); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                </select>

                <div class="source_input">
                    <input type="text"  id="comefrom" name="comefrom" value="" placeholder="请选择渠道来源" readOnly />
                    <div class="source">
                        <ul>
                            <?php foreach($pfrom as $item):?>
                            <li date="<?php echo ($item["from_id"]); ?>"><?php echo ($item["from_name"]); ?></li>
                            <?php endforeach;?>
                        </ul>
                    </div>
                    <div class="sourceCity">
                        <ul>
                            <?php if(is_array($bc_city)): foreach($bc_city as $k=>$vo): ?><li date-city="<?php echo ($k); ?>"><?php echo ($vo); ?></li><?php endforeach; endif; ?>
                        </ul>
                    </div>
                    <div class="sourceTab">
                        <?php if(is_array($comefrom_list)): foreach($comefrom_list as $k=>$cl): ?><div class="sourceList" date-pid="<?php echo ($k); ?>">
                                <ul>
                                    <?php if(is_array($cl)): foreach($cl as $key=>$clv): ?><li date-id="<?php echo ($clv["from_id"]); ?>"><?php echo ($clv["from_name"]); ?></li><?php endforeach; endif; ?>
                                </ul>
                            </div><?php endforeach; endif; ?>

                        <div class="sourceList siSdian">
                            <?php if(is_array($city_fours_list)): foreach($city_fours_list as $k=>$cfl): ?><ul style="display: none;" date-code-city="<?php echo ($k); ?>">
                                    <?php if(is_array($cfl)): foreach($cfl as $key=>$cflv): ?><li date-id="<?php echo ($cflv["from_id"]); ?>"><?php echo ($cflv["from_name"]); ?></li><?php endforeach; endif; ?>
                                </ul><?php endforeach; endif; ?>
                        </div>
                    </div>
                </div>

                <input type="text" id="order_no" name="order_no" value="<?php echo ($params["order_no"]); ?>"  placeholder="拍卖单号"  class="text_model">
                <input type="button" id="search" value="搜索" class="search_btn">
            </div>

            <div class="listBox" id="listBox" style="padding-top: 15px;">

            </div>

            <div class="yunBei" style="display:none"></div>
            <form id="add_fm">
                <div class="tanShang tanShang6" style="display:none;padding-bottom:50px;">
                    <h3>重拍</h3>
                    <ul class="daiJingW">
                        <li class="clearfix">
                            <h1 style="text-align:center">您确定将此车辆<b style="color:red"> 重拍 </b>吗？</h1>
                        </li>
                        <li class="clearfix">
                            <span style="width:90px; text-align:right;float:left;margin-left:20px;">保留价：</span>
                            <input style="width: 250px;" type="text" name="reserve_price" onclick="if (this.value == '请输入金额') this.value = '';" value="请输入金额" />
                            <em>元</em>
                        </li>
                        <li class="clearfix">
                            <div class="limit">
                                <input type="hidden" id="last_transfer_limit" name="last_transfer_limit" value=""/>
                                <input type="hidden" id="transfer_limit" name="transfer_limit" value=""/>
                                <span>过户限制：</span>
                                <?php foreach(C('TRANSFER_LIMIT') as $tk=>$val):?>
                                <em id="tlk_<?php echo ($tk); ?>" class="<?php echo $detail['transfer_limit']==$tk ? 'active' : '' ;?>" data-id="<?php echo ($tk); ?>"><?php echo ($val); ?></em>
                                <?php endforeach;?>
                            </div>
                        </li>
                        <li class="clearfix">
                            <input type="hidden" name="order_id">
                            <input type="hidden" name="owner_id">
                            <input type="hidden" name="consult_id">
                            <input type="button" value="确定" class="queding" id="qd_re_auction"/>
                            <input type="button" value="取消" class="quxiao" />
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        </div>
    </div>
    <div class="clear"></div>
    <div class="yunBei"></div>
<div class="loading"></div>
</body>
</html>

    <script type="text/javascript">
        $("body,html").click(function(event) {
            $(".sourceCity").hide();
            $(".sourceTab .sourceList").hide();
            $(".source").hide();
            event.stopPropagation();
        });

        $(".source_input").click(function(event) {
            event.stopPropagation();
        });
        $(".source_input input").val("");
        $(".source_input input").click(function() {
//            $(this).val("");
            if($(".source").css("display")=="none"){
                $(".source").fadeIn();
            }else{
                $(".source").hide();
            }
            $(".sourceCity").hide();
            $(".sourceTab .sourceList").hide();
        });
        var index;
        var text;
        var dateIndex;
        $(".source ul li").click(function() {
            index=$(".source ul li").index(this);
            text=$(this).html();
            dateIndex=$(this).attr("date");
            if(dateIndex==5){
                $(".sourceCity").fadeIn();
                $(".sourceTab .sourceList").hide();
            }else{
                $(".sourceCity").hide();
                $(".sourceTab .sourceList[date-pid='"+dateIndex+"']").fadeIn().siblings().hide();
            }
            $(this).parent().parent().hide();
        });
        var city;
        var cityIndex;
        $(".sourceCity ul li").click(function(i){
            city=$(this).html();
            $(this).parent().parent().hide();
            cityIndex=$(this).attr("date-city");
            $(".sourceTab .siSdian").fadeIn().find("ul[date-code-city='"+cityIndex+"']").fadeIn().siblings().hide();
        })
        $(".sourceList ul li").click(function(){
            $(this).parent().parent().hide();
            if(index==3){
                $(".source_input input").val(text+" - "+city+" - "+$(this).html());
                $(".source_input input").attr("real-value",$(this).attr("date-id"));
            }else{
                $(".source_input input").val(text+" - "+$(this).html());
                $(".source_input input").attr("real-value",$(this).attr("date-id"));
            }
        });


        //检查拍单是否被跟踪
        function is_trace_assigned(consult_id, consult_status) {
            var param = {'consult_id': consult_id,'consult_status':consult_status, 'type': 'consult_trace'};
            $.get("/Consult/is_consult_assigned", param, function (data) {
                if (data.code == '526') {
                    shibai_alert(data.msg, 2000, function () {
                        window.location.reload()
                    });
                } else if (data.code != '200') {
                    shibai_alert(data.msg, 2000, function () {
                        window.location.reload()
                    });
                } else {
                    window.location.href = data.data;
                }
            }, "json");
        }

        function limit(){
            $(".limit em").click(function(){
                $(".limit em").removeClass("active");
                $(this).addClass("active")
                $("#transfer_limit").val($(this).attr('data-id'));
            })
        }
        limit();
        function re_auction(order_id,owner_id){
            $.post("/AuOrder/re_auction_detail", {'order_id':order_id}, function (data) {
                if(data.code == '200'){
                    $("#last_transfer_limit").val(data.data.transfer_limit);
                    $("#transfer_limit").val(data.data.transfer_limit);
                    $("input[name='reserve_price']").val(data.data.reserve_price);
                    $(".limit em").removeClass("active");
                    $("#tlk_" + data.data.transfer_limit).addClass("active");
                    $("input[name='order_id']").val(order_id);
                    $("input[name='owner_id']").val(owner_id);
                    $('.yunBei,.tanShang').show();
                }else{
                    shibai_alert(data.msg);
                }
            }, "json");
        }
        $("#qd_re_auction").on('click',function(){
            var order_id = $("input[name='order_id']").val();
            var owner_id = $("input[name='owner_id']").val();
            var reserve_price = $("input[name='reserve_price']").val();
            var last_transfer_limit = $("#last_transfer_limit").val();
            var transfer_limit = $("#transfer_limit").val();
            var params = {
                'order_id':order_id,
                'owner_id':owner_id,
                'reserve_price':reserve_price,
                'last_transfer_limit':last_transfer_limit,
                'transfer_limit':transfer_limit
            };
            $.post("/Consult/re_auction", params, function (data) {
                if (data.code == '200') {
                    btn_alert(data.msg, 2000, function () {
                        window.location.reload()
                    });
                } else {
                    shibai_alert(data.msg);
                }
            }, "json");
        });
        $(".tanShang ul li .quxiao").click(function(){
            $(".tanShang").fadeOut();
            $(".yunBei").css("display","none");
        });


        function get_page(p){
            var status = $("#status").val();
            var url = get_url();
            url += "&p=" + p;
            $.get("/Consult/consult_list?status=" + status, encodeURI(url), function(data){
                $("#listBox").html(data);
            },"html");
        }
        get_list(1);
        change_search(0);
        function get_list(status){
            change_tabs(status);
            $("#status").val(status);
            var url = get_url();
            $.get("/Consult/consult_list?status=" + status ,url,function(data){
                $("#listBox").html(data);
            },"html");
        }

        function get_url(){
            var url = "";
            var location_area = $("#location_area").val();
            var trace_start_time = $("#trace_start_time").val();
            var trace_end_time = $("#trace_end_time").val();
            var consult_start_time = $("#consult_start_time").val();
            var consult_end_time = $("#consult_end_time").val();
            var comefrom = $('#comefrom').attr('real-value');
            var order_no = $("#order_no").val();
            if (location_area > 0) {
                url += '&location_area=' + location_area;
            }
            if(trace_start_time){
                url += '&trace_start_time=' + trace_start_time;
            }
            if(trace_end_time){
                url += '&trace_end_time=' + trace_end_time;
            }
            if(consult_start_time){
                url += '&consult_start_time=' + consult_start_time;
            }
            if(consult_end_time){
                url += '&consult_end_time=' + consult_end_time;
            }
            if (comefrom) {
                url += '&comefrom=' + comefrom;
            }
            if (order_no) {
                url += '&order_no=' + order_no;
            }
            return url;
        }

        $('#search').on('click',function(){
            var status = $("#status").val();
            get_list(status);
            // clear_params();
        });

        function change_tabs(status){
            if($("#status").val() != status){
                clear_form_params();
            }
        }

        function change_search(st){
            var s1=$("#search1"),s2=$("#search2"),s3=$('.source_input');
            if(st == 0){
                clear_form_params();
                s1.hide();
                s2.hide();
                s3.hide();
            }
            if(st == 1){
                clear_form_params();
                s3.hide();
                s2.hide();
                s1.show();
            }
            if(st == 2){
                clear_form_params();
                s1.hide();
                s2.show();
                s3.show();
            }

        }

        function clear_form_params(){
            $(':input').not(':button, :submit, :reset, :hidden, select').val('');
            $('#comefrom').removeAttr('real-value');
            if($("#location_area option").length > 1){
                $("#location_area").val(0);
            }
        }

        $("#trace_start_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });

        $("#trace_end_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });
        $("#consult_start_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });

        $("#consult_end_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });
    </script>